#include "indicators.h"
#include "p30F6010A.h"
#include "interface_defines.h"

int indicatorTicks = 0;

void init_LEDs(void)
{
	TRISDbits.TRISD3 = 0;
	TRISDbits.TRISD2 = 0;
};

void indicator_tick_callback(void)
{
	indicatorTicks++;

	if(op_status.passthrough == 1)
	{
		redLEDon();
	}
	else
	{
		redLEDoff();
	}

	if(op_status.rx_ok == 1)
	{
		greenLEDon();
	}
	else
	{
		greenLEDoff();
	}


	if(indicatorTicks >= 200)
	{
		indicatorTicks = 0;
	}
};

inline void redLEDon(void)
{
	LATDbits.LATD2 = 1;
}; 	

inline void redLEDoff(void)
{
	LATDbits.LATD2 = 0;
}; 	

inline void greenLEDon(void)
{
	LATDbits.LATD3 = 1;
};

inline void greenLEDoff(void)
{
	LATDbits.LATD3 = 0;
};	

